package com.woniu.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysPost;
import com.woniu.entity.FirstTrail;
import com.woniu.entity.Production;
import com.woniu.service.ProductionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: 王汇麒  <br/>
 * Date: 2022/9/21:17:42  <br/>
 * Description:
 */
@Api(value = "产品", tags = {"产品"})
@RestController
@RequestMapping("/production")
public class ProductionController  extends BaseController {
    @Autowired
    private ProductionService productionService;

    @ApiOperation("查询所有")
    @GetMapping("/list")
    public TableDataInfo list(@ApiParam("产品实体类")Production production)
    {
        startPage();
        List<Production> list = productionService.selectProductionList(production);
        return getDataTable(list);
    }

    @ApiOperation("启用产品")
    @PostMapping("/enable/{productionId}")
    public AjaxResult enable(@PathVariable Integer productionId){
        return toAjax(productionService.enableProductionById(productionId));
    }

    @ApiOperation("禁用产品")
    @PostMapping("/disable/{productionId}")
    public AjaxResult disable(@PathVariable Integer productionId){
        return toAjax(productionService.disableProductionById(productionId));
    }

}
